package top.chengdongqing.mishop.common.pageable

import org.springframework.data.domain.Page
import java.io.Serializable

data class Page1<T>(
    val pageNumber: Int,
    val pageSize: Int,
    val totalSize: Int,
    val totalPages: Int,
    val data: List<T>
) : Serializable {

    companion object {
        fun <T> of(page: Page<T>): Page1<T> {
            return Page1(
                page.number + 1,
                page.size,
                page.totalElements.toInt(),
                page.totalPages,
                page.content
            )
        }
    }
}
